var timerID = null
var timerRunning = false
var timeleft=0

function setlefttime(s)
{
		timeleft=s*60;
}

function stopclock(){
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function showtime(){
		
		var hourstr= Math.floor(timeleft/3600);
    var minstr = Math.floor((timeleft%3600)/60);
    var secstr= timeleft%60;
    var s="";
    if(hourstr<10)
    	s+="0"+hourstr;
    else
    	s+=hourstr;
    s+=":"
    if(minstr<10)
    	s+="0"+minstr;
    else
    	s+=minstr;
    s+=":";
    if(secstr<10)
    	s+="0"+secstr;
    else
    	s+=secstr;    
    document.all.timeleft.innerText = s; 
    timeleft=timeleft-1;
    if(timeleft<=0)    
    	window.formIon.submit();
    else
    	timerID = setTimeout("showtime()",1000);
    timerRunning = true;
}

